//
// Created by PC on 2023/3/7.
// 返回第N个斐波那契数
//

#include <iostream>
using namespace std;

int fibonacci(int n)
{
    if (n<0)
        return 0;
    if(n<3)
        return 1;
    int per=1;
    int cur = 2;
    for (int i = 4; i <= n; ++i)
    {
        cur+=per;
        per = cur-per;
    }
    return cur;
}

int main()
{
    int num = 10;
    int f = fibonacci(num);
    cout<<f<<endl;
    return 0;
}